package com.hulk.boot.web.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.hulk.boot.persistence.mapper.TInfoCustomerMapper;
import com.hulk.boot.persistence.model.TInfoCustomer;

@Controller
public class TestController {
	
	@Autowired
	private JdbcTemplate template;
	
	@Autowired
	private TInfoCustomerMapper mapper;
	
	@RequestMapping("/test")
	public ModelAndView test(){
//		List<Map<String,Object>> list = template.queryForList(" select * FROM T_INFO_CUSTOMER ");
		List<TInfoCustomer> list = mapper.selectByExample(null);
		ModelAndView rs = new ModelAndView("index");
		rs.addObject("list", list);
		return rs;
	}
	
	@RequestMapping("/testjson")
	@ResponseBody
	public List<TInfoCustomer> testjson(){
		List<TInfoCustomer> list = mapper.selectByExample(null);
		return list;
	}
}
